package com.jack.payment.entity.request;


import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Range;

import java.io.Serializable;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Schema(name = "基础账号信息")
public class BasicAccountModel implements Serializable {
    @NotBlank(message = "账号信息不能为空哦")
    @Schema(description = "账户")
    private String account;
    @NotBlank(message = "重要信息不能为空哦")
    @Schema(description = "密码 或 验证码")
    private String pwd;
    @Range(min = 0, max = 2, message = "[0: 邮箱 1: 手机号码 2: 密码")
    @Schema(description = "来源")
    private Integer source;

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @Schema(description = "请求时发送的验证码")
    public static class SendVerifyCodeModel implements Serializable {
        @NotBlank(message = "账号信息不能为空哦")
        @Schema(description = "账号")
        private String account;
        @Range(min = 0, max = 1, message = "来源只能是手机 或 email")
        @Schema(description = "来源[0: 邮箱 1: 手机号码]")
        private Integer source;
        @Range(min = 0, max = 3, message = "数据类型超出")
        @Schema(description = "类别[具体查看AccountVerifyCodeEnum]")
        private Integer type;
    }


    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(name = "注册时, 客户端请求参数")
    public static class RegisterModel extends BasicAccountModel implements Serializable {
        @NotBlank(message = "验证码信息不能为空")
        @Schema(description = "验证码")
        private String verifyCode;
        @Schema(description = "名称")
        private String name;
        @Schema(description = "头像")
        private String iconUrl;
    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(name = "忘记密码")
    public static class ForgetPassModel extends BasicAccountModel implements Serializable {
        @NotBlank(message = "重要信息缺失")
        @Schema(description = "验证码")
        private String verifyCode;
    }


    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(name = "修改登录密码, ")
    public static class UpdateLoginPwdModel implements Serializable {
        @Schema(description = "旧密码")
        @NotBlank(message = "旧密码不能为空")
        private String oldPwd;
        @Schema(description = "新密码")
        @NotBlank(message = "新密码不能为空")
        private String pwd;
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @Schema(name = "修改用户基础信息")
    public static class UpdateUserDetailModel implements Serializable {
        @Schema(description = "用户呢称")
        public String name;
        @Schema(description = "用户头像")
        public String iconUrl;
        @Schema(description = "用户描述")
        private String motto;
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @Schema(name = "三方登录 后直接进行注册")
    public static class AuthLoginRegisterModel implements Serializable {
        @NotBlank(message = "重要信息缺失")
        @Schema(description = "三方唯一id")
        private String secret;
        @NotBlank(message = "重要信息缺失")
        @Schema(description = "渠道")
        @NotBlank(message = "重要信息缺失")
        private Integer channel;
        @Schema(description = "用户名称")
        private String name;
        @Schema(description = "用户头像")
        private String iconUrl;
        @Schema(description = "密码")
        @NotBlank(message = "重要信息缺失")
        private String pwd;
        @Schema(description = "三方账号")
        private String thirdAccount;
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @Schema(name = "三方登录与绑定")
    public static class AuthLoginBindAccountModel extends  AuthLoginRegisterModel {
        @NotBlank(message = "重要信息缺失")
        @Schema(description = "账号")
        private String account;
        @Schema(description = "验证码")
        @NotBlank(message = "重要信息缺失")
        private String verifyCode;
        @Schema(description = "来源")
        @NotBlank(message = "重要信息缺失")
        private Integer source;
    }
}
